﻿/**
 * Copyright (C) 2011 original author and authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NGuice.Inject
{
    /// <summary>
    /// 你的实现类（构造器、方法和域）的成员被Injector注入器注入值的元特性注释，他为以下注入请求注入值：
    /// <list type="bullt">
    /// <item>
    /// 他构造的每一个实例：被构造的类必须具有其构造器的一个确切的Inject标注或者必须具有一个无参的构造，然后注入器执行方法和域的注入
    /// </item>
    /// <item>
    ///  传递给Injector.InjectMembers的预构造的实例，<code>NGuice.Inject.Binder.LinkedBindingBuilder.ToInstance(object)</code>与
    ///  <code>NGuice.Inject.Binder.LinkedBindingBuilder.ToProvider(Provider)</code>这种情况下，所有的构造器都将被忽略
    /// </item>
    /// <item>
    /// 所有Module指定的使用Binder.RequestStaticInjection的静态注入请求中要求注入的静态域和方法
    /// </item>
    /// </list>
    /// 所有这些注入的成员，无论其修饰为public、private、protected、internal都将被注入！
    /// </summary>
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Field | AttributeTargets.Property)]
    public class InjectAttribute: Attribute
    {
        private bool optional = false;

        public bool Optional
        {
            get { return optional; }
            set { optional = value; }
        }
    }
}
